* Figure 1 -- Treatment Effects across All Six Experiments *
* The code below also produces all of the numbers and significance tests needed to create SI Table 3 *
cd "/Users/dlk265/Library/CloudStorage/Box-Box/Executive Politics Directed Study/Youngstown experiments/Stata data sets/"
use "youngstown_12combined.dta", clear
gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .

reg hyp_coin_support hyp_coin_treat_zone1 hyp_coin_treat_zone3
test hyp_coin_treat_zone1 = hyp_coin_treat_zone3
replace diff = _b[hyp_coin_treat_zone1] if n == 11
replace sediff = _se[hyp_coin_treat_zone1] if n == 11
replace treatment = 1 if n == 11
replace diff = _b[hyp_coin_treat_zone3] if n == 10
replace sediff = _se[hyp_coin_treat_zone3] if n == 10
replace treatment = 0 if n == 10

reg biden_coin_support biden_coin_treat_zone1 biden_coin_treat_zone3
test biden_coin_treat_zone1 = biden_coin_treat_zone3
replace diff = _b[biden_coin_treat_zone1] if n == 14
replace sediff = _se[biden_coin_treat_zone1] if n == 14
replace treatment = 1 if n == 14
replace diff = _b[biden_coin_treat_zone3] if n == 13
replace sediff = _se[biden_coin_treat_zone3] if n == 13
replace treatment = 0 if n == 13

reg hyp_loan_support hyp_loan_treat_zone1 hyp_loan_treat_zone3
test hyp_loan_treat_zone1 = hyp_loan_treat_zone3
replace diff = _b[hyp_loan_treat_zone1] if n == 8
replace sediff = _se[hyp_loan_treat_zone1] if n == 8
replace treatment = 1 if n == 8
replace diff = _b[hyp_loan_treat_zone3] if n == 7
replace sediff = _se[hyp_loan_treat_zone3] if n == 7
replace treatment = 0 if n == 7

reg clinton_loan_support clinton_loan_treat_zone1 clinton_loan_treat_zone3
test clinton_loan_treat_zone1 = clinton_loan_treat_zone3
replace diff = _b[clinton_loan_treat_zone1] if n == 5
replace sediff = _se[clinton_loan_treat_zone1] if n == 5
replace treatment = 1 if n == 5
replace diff = _b[clinton_loan_treat_zone3] if n == 4
replace sediff = _se[clinton_loan_treat_zone3] if n == 4
replace treatment = 0 if n == 4

reg tribunals_support tribunals_treat_zone1 tribunals_treat_zone3
test tribunals_treat_zone1=tribunals_treat_zone3
replace diff = _b[tribunals_treat_zone1] if n == 2
replace sediff = _se[tribunals_treat_zone1] if n == 2
replace treatment = 1 if n == 2
replace diff = _b[tribunals_treat_zone3] if n == 1
replace sediff = _se[tribunals_treat_zone3] if n == 1
replace treatment = 0 if n == 1

reg wall_support wall_treat_zone1 wall_treat_zone3
test wall_treat_zone1=wall_treat_zone3
replace diff = _b[wall_treat_zone1] if n == 17
replace sediff = _se[wall_treat_zone1] if n == 17
replace treatment = 1 if n == 17
replace diff = _b[wall_treat_zone3] if n == 16
replace sediff = _se[wall_treat_zone3] if n == 16
replace treatment = 0 if n == 16

replace l = diff-1.96*(sediff)
replace u = diff+1.96*(sediff)
replace n = . if n > 17

twoway (dot  diff n if treatment == 1, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  diff n if treatment == 0, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(rspike u l n, horizontal color(black)), yti("") graphregion(color(white)) ///
xline(0) xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///
ylabel(10.5 "Hypothetical coin" 13.5 "Biden coin" 7.5 "Hypothetical loan" 4.5 "Clinton loan" 1.5 "Bush tribunals" 16.5 "Trump wall", angle(0)) /// 
legend(order( 1 "Zone 1 treatment" 2 "Zone 3 treatment") size(medsmall) keygap(0) cols(2)) scale(.75) 

* Figure 2: Rule of Law Moderation, Survey 1 *
use "youngstown_12combined.dta", clear
logit tribunals_support i.tribunals_treat_zone1##c.rule_of_law dem5 gop5 female age education white if tribunals_treat_zone1 == 1|tribunals_treat_zone3 == 1
margins, dydx(tribunals_treat_zone1) at(rule_of_law=(1 (.1) 4) dem5=0 gop5=0 female=1 age=44 white=1 education=3) 
marginsplot, recast(line) recastci(rarea)  ///
title("Bush tribunals") xtitle("Rule of Law Index") graphregion(color(white))   plot1opts(lpattern("solid") lcolor(black)) ///
ci1opts(color(gs10) lcolor(black)  color(%50))  yti("Diff. support (delegation - contra Congress)" " ") ///
yline(0, style(foreground) lpattern(--)) scale(.75) saving(bush_tribunals_zones_rol.gph, replace) 

logit clinton_loan_support i.clinton_loan_treat_zone1##c.rule_of_law dem5 gop5 female age education white if clinton_loan_treat_zone1 == 1|clinton_loan_treat_zone3 == 1
margins, dydx(clinton_loan_treat_zone1) at(rule_of_law=(1 (.1) 4) dem5=0 gop5=0 female=1 age=44 white=1 education=3) 
marginsplot, recast(line) recastci(rarea)  ///
title("Clinton Mexico loan") xtitle("Rule of Law Index") graphregion(color(white))   plot1opts(lpattern("solid") lcolor(black)) ///
ci1opts(color(gs10) lcolor(black)  color(%50))  yti("Diff. support (delegation - contra Congress)" " ") ///
yline(0, style(foreground) lpattern(--)) scale(.75) saving(clinton_loan_zones_rol.gph, replace) 

logit hyp_coin_support i.hyp_coin_treat_zone1##c.rule_of_law dem5 gop5 female age education white if hyp_coin_treat_zone1 == 1|hyp_coin_treat_zone3 == 1
margins, dydx(hyp_coin_treat_zone1) at(rule_of_law=(1 (.1) 4) dem5=0 gop5=0 female=1 age=44 white=1 education=3) 
marginsplot, recast(line) recastci(rarea)  ///
title("Hypothetical coin") xtitle("Rule of Law Index") graphregion(color(white))   plot1opts(lpattern("solid") lcolor(black)) ///
ci1opts(color(gs10) lcolor(black)  color(%50))  yti("Diff. support (delegation - contra Congress)" " ") ///
yline(0, style(foreground) lpattern(--)) scale(.75) saving(hyp_coin_zones_rol.gph, replace) 

logit hyp_loan_support i.hyp_loan_treat_zone1##c.rule_of_law dem5 gop5 female age education white if hyp_loan_treat_zone1 == 1|hyp_loan_treat_zone3 == 1
margins, dydx(hyp_loan_treat_zone1) at(rule_of_law=(1 (.1) 4) dem5=0 gop5=0 female=1 age=44 white=1 education=3) 
marginsplot, recast(line) recastci(rarea)  ///
title("Hypothetical Mexico loan") xtitle("Rule of Law Index") graphregion(color(white))   plot1opts(lpattern("solid") lcolor(black)) ///
ci1opts(color(gs10) lcolor(black)  color(%50))  yti("Diff. support (delegation - contra Congress)" " ") ///
yline(0, style(foreground) lpattern(--)) scale(.75) saving(hyp_hyp_loan_zones_rol.gph, replace) 

logit biden_coin_support i.biden_coin_treat_zone1##c.rule_of_law dem5 gop5 female age education white if biden_coin_treat_zone1 == 1|biden_coin_treat_zone3 == 1
margins, dydx(biden_coin_treat_zone1) at(rule_of_law=(1 (.1) 4) dem5=0 gop5=0 female=1 age=44 white=1 education=3) 
marginsplot, recast(line) recastci(rarea)  ///
title("Biden coin") xtitle("Rule of Law Index") graphregion(color(white))   plot1opts(lpattern("solid") lcolor(black)) ///
ci1opts(color(gs10) lcolor(black)  color(%50))  yti("Diff. support (delegation - contra Congress)" " ") ///
yline(0, style(foreground) lpattern(--)) scale(.75) saving(biden_coin_zones_rol.gph, replace) 

logit wall_support i.wall_treat_zone1##c.rule_of_law dem5 gop5 female age education white if wall_treat_zone1 == 1|wall_treat_zone3 == 1
margins, dydx(wall_treat_zone1) at(rule_of_law=(1 (.1) 4) dem5=0 gop5=0 female=1 age=44 white=1 education=3) 
marginsplot, recast(line) recastci(rarea)  ///
title("Trump wall") xtitle("Rule of Law Index") graphregion(color(white))   plot1opts(lpattern("solid") lcolor(black)) ///
ci1opts(color(gs10) lcolor(black)  color(%50))  yti("Diff. support (delegation - contra Congress)" " ") ///
yline(0, style(foreground) lpattern(--)) scale(.75) saving(trump_wall_zones_rol.gph, replace) 

graph combine "trump_wall_zones_rol.gph" "biden_coin_zones_rol.gph" "hyp_coin_zones_rol.gph" "hyp_loan_zones_rol.gph"  "clinton_loan_zones_rol.gph" "bush_tribunals_zones_rol.gph", graphregion(color(white))

* Figure 3: Effects by Party *
* Hypothetical Coin *
use  "youngstown_12combined.dta", clear
gen party3 = .
replace party3=1 if dem5==1
replace party3 = 2 if dem5 == 0 & gop5 == 0
replace party3 = 3 if gop5 == 1

gen hypcoin_condition = .
replace hypcoin_condition = 1 if hyp_coin_treat_zone1 == 0&hyp_coin_treat_zone3==0
replace hypcoin_condition = 2 if hyp_coin_treat_zone1 == 1
replace hypcoin_condition = 3 if hyp_coin_treat_zone3 == 1

logit hyp_coin_support i.hypcoin_condition##i.party3 female age education white rule_of_law
margins, at(party3=(1 (1) 3) hypcoin_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)  post
margins, coeflegend
* Test Democrats delegation vs. contra Congress *
test _b[4._at] = _b[7._at]
* Test Independents delegation vs. contra Congress *
test _b[5._at] = _b[8._at]
* Test Republicans delegation vs. contra Congress *
test _b[6._at] = _b[9._at]

logit hyp_coin_support i.hypcoin_condition##i.party3 female age education white rule_of_law
margins, at(party3=(1 (1) 3) hypcoin_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)
matrix results = r(table)
matrix list results

gen n = _n
gen point = .
gen l = .
gen u = .
gen party = .
gen treatment = .

local a = results[1,1]
replace point = results[1,4] if n == 8
replace l = results[5,4] if n == 8
replace u = results[6,4] if n == 8
replace treatment = 1 if n == 8

replace point = results[1,7] if n == 7
replace l = results[5,7] if n == 7
replace u = results[6,7] if n == 7
replace treatment = 2 if n == 7

local b = results[1,2]
replace point = results[1,5] if n == 5
replace l = results[5,5] if n == 5
replace u = results[6,5] if n == 5
replace treatment = 1 if n == 5

replace point = results[1,8] if n == 4
replace l = results[5,8] if n == 4
replace u = results[6,8] if n == 4
replace treatment = 2 if n == 4

local c = results[1,3]
replace point = results[1,6] if n == 2
replace l = results[5,6] if n == 2
replace u = results[6,6] if n == 2
replace treatment = 1 if n == 2

replace point = results[1,9] if n == 1
replace l = results[5,9] if n == 1
replace u = results[6,9] if n == 1
replace treatment = 2 if n == 1

drop if n > 8

twoway (dot  point n if treatment == 1, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  point n if treatment == 2, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(dot  point n if treatment == 3, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(rspike u l n, horizontal color(black)), yti("") graphregion(color(white)) ///
xline(`a', lcolor(blue)) xline(`b', lpattern(dash) lcolor(black)) xline(`c', lpattern(shortdash)) xlabel(.1 .2 .3 .4 .5 .6 .7 .8 .9)  ///
ylabel(7.5 "Democrats" 4.5 "Independents" 1.5 "Republicans", angle(0)) /// 
legend(order( 1 "Zone 1 Treatment" 2 "Zone 3 Treatment")  size(vsmall) keygap(0) cols(2)) scale(.75) yscale(range(.5 8.5)) ti("Hypothetical coin") saving(hypcoin_party.gph, replace)

* Biden Coin *
use  "youngstown_12combined.dta", clear
gen party3 = .
replace party3=1 if dem5==1
replace party3 = 2 if dem5 == 0 & gop5 == 0
replace party3 = 3 if gop5 == 1

gen bidencoin_condition = .
replace bidencoin_condition = 1 if biden_coin_treat_zone1 == 0 & biden_coin_treat_zone3==0
replace bidencoin_condition = 2 if biden_coin_treat_zone1 == 1
replace bidencoin_condition = 3 if biden_coin_treat_zone3 == 1

logit biden_coin_support i.bidencoin_condition##i.party3 female age education white rule_of_law
margins, at(party3=(1 (1) 3) bidencoin_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3) post
margins, coeflegend
* Test Democrats delegation vs. contra Congress *
test _b[4._at] = _b[7._at]
* Test Independents delegation vs. contra Congress *
test _b[5._at] = _b[8._at]
* Test Republicans delegation vs. contra Congress *
test _b[6._at] = _b[9._at] 

logit biden_coin_support i.bidencoin_condition##i.party3 female age education white rule_of_law
margins, at(party3=(1 (1) 3) bidencoin_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)
matrix results = r(table)
matrix list results

gen n = _n
gen point = .
gen l = .
gen u = .
gen party = .
gen treatment = .

local a = results[1,1]
replace point = results[1,4] if n == 8
replace l = results[5,4] if n == 8
replace u = results[6,4] if n == 8
replace treatment = 1 if n == 8

replace point = results[1,7] if n == 7
replace l = results[5,7] if n == 7
replace u = results[6,7] if n == 7
replace treatment = 2 if n == 7

local b = results[1,2]
replace point = results[1,5] if n == 5
replace l = results[5,5] if n == 5
replace u = results[6,5] if n == 5
replace treatment = 1 if n == 5

replace point = results[1,8] if n == 4
replace l = results[5,8] if n == 4
replace u = results[6,8] if n == 4
replace treatment = 2 if n == 4

local c = results[1,3]
replace point = results[1,6] if n == 2
replace l = results[5,6] if n == 2
replace u = results[6,6] if n == 2
replace treatment = 1 if n == 2

replace point = results[1,9] if n == 1
replace l = results[5,9] if n == 1
replace u = results[6,9] if n == 1
replace treatment = 2 if n == 1

drop if n > 8

twoway (dot  point n if treatment == 1, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  point n if treatment == 2, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(dot  point n if treatment == 3, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(rspike u l n, horizontal color(black)), yti("") graphregion(color(white)) ///
xline(`a', lcolor(blue)) xline(`b', lpattern(dash) lcolor(black)) xline(`c', lpattern(shortdash)) xlabel(.1 .2 .3 .4 .5 .6 .7 .8 .9) ///
ylabel(7.5 "Democrats" 4.5 "Independents" 1.5 "Republicans", angle(0)) /// 
legend(order( 1 "Zone 1 Treatment" 2 "Zone 3 Treatment")  size(vsmall) keygap(0) cols(2)) scale(.75) yscale(range(.5 8.5)) ti("Biden coin") saving(bidencoin_party.gph, replace)

* Bush Tribunals *
use  "youngstown_12combined.dta", clear
gen party3 = .
replace party3=1 if dem5==1
replace party3 = 2 if dem5 == 0 & gop5 == 0
replace party3 = 3 if gop5 == 1

gen bushtribunals_condition = .
replace bushtribunals_condition = 1 if tribunals_treat_zone1 == 0 & tribunals_treat_zone3==0
replace bushtribunals_condition = 2 if tribunals_treat_zone1 == 1
replace bushtribunals_condition = 3 if tribunals_treat_zone3 == 1

logit tribunals_support i.bushtribunals_condition##i.party3 female age education white rule_of_law
margins, at(party3=(1 (1) 3) bushtribunals_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)  post
margins, coeflegend
* Test Democrats delegation vs. contra Congress *
test _b[4._at] = _b[7._at]
* Test Independents delegation vs. contra Congress *
test _b[5._at] = _b[8._at]
* Test Republicans delegation vs. contra Congress *
test _b[6._at] = _b[9._at]

logit tribunals_support i.bushtribunals_condition##i.party3 female age education white rule_of_law
margins, at(party3=(1 (1) 3) bushtribunals_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)
matrix results = r(table)
matrix list results

gen n = _n
gen point = .
gen l = .
gen u = .
gen party = .
gen treatment = .

local a = results[1,1]
replace point = results[1,4] if n == 8
replace l = results[5,4] if n == 8
replace u = results[6,4] if n == 8
replace treatment = 1 if n == 8

replace point = results[1,7] if n == 7
replace l = results[5,7] if n == 7
replace u = results[6,7] if n == 7
replace treatment = 2 if n == 7

local b = results[1,2]
replace point = results[1,5] if n == 5
replace l = results[5,5] if n == 5
replace u = results[6,5] if n == 5
replace treatment = 1 if n == 5

replace point = results[1,8] if n == 4
replace l = results[5,8] if n == 4
replace u = results[6,8] if n == 4
replace treatment = 2 if n == 4

local c = results[1,3]
replace point = results[1,6] if n == 2
replace l = results[5,6] if n == 2
replace u = results[6,6] if n == 2
replace treatment = 1 if n == 2

replace point = results[1,9] if n == 1
replace l = results[5,9] if n == 1
replace u = results[6,9] if n == 1
replace treatment = 2 if n == 1

drop if n > 8

twoway (dot  point n if treatment == 1, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  point n if treatment == 2, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(dot  point n if treatment == 3, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(rspike u l n, horizontal color(black)), yti("") graphregion(color(white)) ///
xline(`a', lcolor(blue)) xline(`b', lpattern(dash) lcolor(black)) xline(`c', lpattern(shortdash)) xlabel(.1 .2 .3 .4 .5 .6 .7 .8 .9)  ///
ylabel(7.5 "Democrats" 4.5 "Independents" 1.5 "Republicans", angle(0)) /// 
legend(order( 1 "Zone 1 Treatment" 2 "Zone 3 Treatment") size(vsmall) keygap(0) cols(2)) scale(.75) yscale(range(.5 8.5)) ti("Bush tribunals") saving(tribunals_party.gph, replace)

* Trump Wall *
use  "youngstown_12combined.dta", clear
gen party3 = .
replace party3=1 if dem5==1
replace party3 = 2 if dem5 == 0 & gop5 == 0
replace party3 = 3 if gop5 == 1

gen wall_condition = .
replace wall_condition = 1 if wall_treat_zone1 == 0&wall_treat_zone3==0
replace wall_condition = 2 if wall_treat_zone1 == 1
replace wall_condition = 3 if wall_treat_zone3 == 1

logit wall_support i.wall_condition##i.party3 female age education white rule_of_law
margins, at(party3=(1 (1) 3) wall_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)  post
margins, coeflegend
* Test Democrats delegation vs. contra Congress *
test _b[4._at] = _b[7._at]
* Test Independents delegation vs. contra Congress *
test _b[5._at] = _b[8._at]
* Test Republicans delegation vs. contra Congress *
test _b[6._at] = _b[9._at]

logit wall_support i.wall_condition##i.party3 female age education white rule_of_law
margins, at(party3=(1 (1) 3) wall_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3) 
matrix results = r(table)
matrix list results

gen n = _n
gen point = .
gen l = .
gen u = .
gen party = .
gen treatment = .

local a = results[1,1]
replace point = results[1,4] if n == 8
replace l = results[5,4] if n == 8
replace u = results[6,4] if n == 8
replace treatment = 1 if n == 8

replace point = results[1,7] if n == 7
replace l = results[5,7] if n == 7
replace u = results[6,7] if n == 7
replace treatment = 2 if n == 7

local b = results[1,2]
replace point = results[1,5] if n == 5
replace l = results[5,5] if n == 5
replace u = results[6,5] if n == 5
replace treatment = 1 if n == 5

replace point = results[1,8] if n == 4
replace l = results[5,8] if n == 4
replace u = results[6,8] if n == 4
replace treatment = 2 if n == 4

local c = results[1,3]
replace point = results[1,6] if n == 2
replace l = results[5,6] if n == 2
replace u = results[6,6] if n == 2
replace treatment = 1 if n == 2

replace point = results[1,9] if n == 1
replace l = results[5,9] if n == 1
replace u = results[6,9] if n == 1
replace treatment = 2 if n == 1

drop if n > 8

twoway (dot  point n if treatment == 1, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  point n if treatment == 2, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(dot  point n if treatment == 3, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(rspike u l n, horizontal color(black)), yti("") graphregion(color(white)) ///
xline(`a', lcolor(blue)) xline(`b', lpattern(dash) lcolor(black)) xline(`c', lpattern(shortdash)) xlabel(.1 .2 .3 .4 .5 .6 .7 .8 .9)  ///
ylabel(7.5 "Democrats" 4.5 "Independents" 1.5 "Republicans", angle(0)) /// 
legend(order( 1 "Zone 1 Treatment" 2 "Zone 3 Treatment")  size(vsmall) keygap(0) cols(2)) scale(.75) yscale(range(.5 8.5)) ti("Trump wall") saving(wall_party.gph, replace)

* Clinton Mexico Loan *
use  "youngstown_12combined.dta", clear

gen party3 = .
replace party3=1 if dem5==1
replace party3 = 2 if dem5 == 0 & gop5 == 0
replace party3 = 3 if gop5 == 1

gen clinton_loan_condition = .
replace clinton_loan_condition = 1 if clinton_loan_treat_zone1 == 0 & clinton_loan_treat_zone3==0
replace clinton_loan_condition = 2 if clinton_loan_treat_zone1 == 1
replace clinton_loan_condition = 3 if clinton_loan_treat_zone3 == 1

logit clinton_loan_support i.clinton_loan_condition##i.party3 female age education white rule_of_law if clinton == 1
margins, at(party3=(1 (1) 3) clinton_loan_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)  post
margins, coeflegend
* Test Democrats delegation vs. contra Congress *
test _b[4._at] = _b[7._at]
* Test Independents delegation vs. contra Congress *
test _b[5._at] = _b[8._at]
* Test Republicans delegation vs. contra Congress *
test _b[6._at] = _b[9._at]

logit clinton_loan_support i.clinton_loan_condition##i.party3 female age education white rule_of_law 
margins, at(party3=(1 (1) 3) clinton_loan_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)
matrix results = r(table)
matrix list results

gen n = _n
gen point = .
gen l = .
gen u = .
gen party = .
gen treatment = .

local a = results[1,1]
replace point = results[1,4] if n == 8
replace l = results[5,4] if n == 8
replace u = results[6,4] if n == 8
replace treatment = 1 if n == 8

replace point = results[1,7] if n == 7
replace l = results[5,7] if n == 7
replace u = results[6,7] if n == 7
replace treatment = 2 if n == 7

local b = results[1,2]
replace point = results[1,5] if n == 5
replace l = results[5,5] if n == 5
replace u = results[6,5] if n == 5
replace treatment = 1 if n == 5

replace point = results[1,8] if n == 4
replace l = results[5,8] if n == 4
replace u = results[6,8] if n == 4
replace treatment = 2 if n == 4

local c = results[1,3]
replace point = results[1,6] if n == 2
replace l = results[5,6] if n == 2
replace u = results[6,6] if n == 2
replace treatment = 1 if n == 2

replace point = results[1,9] if n == 1
replace l = results[5,9] if n == 1
replace u = results[6,9] if n == 1
replace treatment = 2 if n == 1

drop if n > 8

twoway (dot  point n if treatment == 1, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  point n if treatment == 2, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(dot  point n if treatment == 3, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(rspike u l n, horizontal color(black)), yti("") graphregion(color(white)) ///
xline(`a', lcolor(blue)) xline(`b', lpattern(dash) lcolor(black)) xline(`c', lpattern(shortdash)) xlabel(.1 .2 .3 .4 .5 .6 .7 .8 .9)  ///
ylabel(7.5 "Democrats" 4.5 "Independents" 1.5 "Republicans", angle(0)) /// 
legend(order( 1 "Zone 1 Treatment" 2 "Zone 3 Treatment")  size(vsmall) keygap(0) cols(2)) scale(.75) yscale(range(.5 8.5)) ti("Clinton Mexico loan") saving(clinton_party_noinfo.gph, replace)

* Hypothetical Mexico *
use  "youngstown_12combined.dta", clear

gen party3 = .
replace party3=1 if dem5==1
replace party3 = 2 if dem5 == 0 & gop5 == 0
replace party3 = 3 if gop5 == 1

gen hyp_loan_condition = .
replace hyp_loan_condition = 1 if hyp_loan_treat_zone1 == 0 & hyp_loan_treat_zone3==0
replace hyp_loan_condition = 2 if hyp_loan_treat_zone1 == 1
replace hyp_loan_condition = 3 if hyp_loan_treat_zone3 == 1

logit hyp_loan_support i.hyp_loan_condition##i.party3 female age education white rule_of_law 
margins, at(party3=(1 (1) 3) hyp_loan_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)  post
margins, coeflegend
* Test Democrats delegation vs. contra Congress *
test _b[4._at] = _b[7._at]
* Test Independents delegation vs. contra Congress *
test _b[5._at] = _b[8._at]
* Test Republicans delegation vs. contra Congress *
test _b[6._at] = _b[9._at]

logit hyp_loan_support i.hyp_loan_condition##i.party3 female age education white rule_of_law 
margins, at(party3=(1 (1) 3) hyp_loan_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)
matrix results = r(table)
matrix list results

gen n = _n
gen point = .
gen l = .
gen u = .
gen party = .
gen treatment = .

local a = results[1,1]
replace point = results[1,4] if n == 8
replace l = results[5,4] if n == 8
replace u = results[6,4] if n == 8
replace treatment = 1 if n == 8

replace point = results[1,7] if n == 7
replace l = results[5,7] if n == 7
replace u = results[6,7] if n == 7
replace treatment = 2 if n == 7

local b = results[1,2]
replace point = results[1,5] if n == 5
replace l = results[5,5] if n == 5
replace u = results[6,5] if n == 5
replace treatment = 1 if n == 5

replace point = results[1,8] if n == 4
replace l = results[5,8] if n == 4
replace u = results[6,8] if n == 4
replace treatment = 2 if n == 4

local c = results[1,3]
replace point = results[1,6] if n == 2
replace l = results[5,6] if n == 2
replace u = results[6,6] if n == 2
replace treatment = 1 if n == 2

replace point = results[1,9] if n == 1
replace l = results[5,9] if n == 1
replace u = results[6,9] if n == 1
replace treatment = 2 if n == 1

drop if n > 8

twoway (dot  point n if treatment == 1, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  point n if treatment == 2, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(dot  point n if treatment == 3, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(rspike u l n, horizontal color(black)), yti("") graphregion(color(white)) ///
xline(`a', lcolor(blue)) xline(`b', lpattern(dash) lcolor(black)) xline(`c', lpattern(shortdash)) xlabel(.1 .2 .3 .4 .5 .6 .7 .8 .9)  ///
ylabel(7.5 "Democrats" 4.5 "Independents" 1.5 "Republicans", angle(0)) /// 
legend(order( 1 "Zone 1 Treatment" 2 "Zone 3 Treatment")  size(vsmall) keygap(0) cols(2)) scale(.75) yscale(range(.5 8.5)) ti("Hypothetical Mexico loan") saving(hyploan_party_noinfo.gph, replace)

grc1leg2  "wall_party.gph"  "bidencoin_party.gph"  "hyploan_party_noinfo.gph" "hypcoin_party.gph"  "clinton_party_noinfo.gph" "tribunals_party.gph"   , graphregion(color(white)) rows(3) 
grc1leg2  "wall_party.gph"  "bidencoin_party.gph"  "hyploan_party_noinfo.gph" "hypcoin_party.gph"  "clinton_party_noinfo.gph" "tribunals_party.gph"   , ///
graphregion(color(white)) rows(3) saving("youngstown_figure3.gph", replace)
graph display "youngstown_figure3.gph",  ysize(11) xsize(8.5)

* Figure 4: Treatment Effects for Follow-up Experients vs. Legislation Baseline *
* The code below also produces all of the numbers and significance tests needed to create SI Table 3 *
use  "youngstown_34combined.dta", clear

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .

reg mexloan_support mexloan_treat_zone1  mexloan_treat_zone3
test mexloan_treat_zone1 = mexloan_treat_zone3
replace diff = _b[mexloan_treat_zone1] if n == 5
replace sediff = _se[mexloan_treat_zone1] if n == 5
replace treatment = 1 if n == 5
replace diff = _b[mexloan_treat_zone3] if n == 4
replace sediff = _se[mexloan_treat_zone3] if n == 4
replace treatment = 0 if n == 4

reg clintonloan_support clintonloan_treat_zone1 clintonloan_treat_zone3
test clintonloan_treat_zone1 = clintonloan_treat_zone3
replace diff = _b[clintonloan_treat_zone1] if n == 2
replace sediff = _se[clintonloan_treat_zone1] if n == 2
replace treatment = 1 if n == 2
replace diff = _b[clintonloan_treat_zone3] if n == 1
replace sediff = _se[clintonloan_treat_zone3] if n == 1
replace treatment = 0 if n == 1

*reg studentloans_support studentloans_treat_zone1 studentloans_treat_zone3
*test studentloans_treat_zone1 = studentloans_treat_zone3
*replace diff = _b[studentloans_treat_zone1] if n == 11
*replace sediff = _se[studentloans_treat_zone1] if n == 11
*replace treatment = 1 if n == 11
*replace diff = _b[studentloans_treat_zone3] if n == 10
*replace sediff = _se[studentloans_treat_zone3] if n == 10
*replace treatment = 0 if n == 10

reg biden_studentloans_support biden_studentloans_treat_zone1 biden_studentloans_treat_zone3
test biden_studentloans_treat_zone1 = biden_studentloans_treat_zone3
replace diff = _b[biden_studentloans_treat_zone1] if n == 8
replace sediff = _se[biden_studentloans_treat_zone1] if n == 8
replace treatment = 1 if n == 8
replace diff = _b[biden_studentloans_treat_zone3] if n == 7
replace sediff = _se[biden_studentloans_treat_zone3] if n == 7
replace treatment = 0 if n == 7

replace l = diff-1.96*(sediff)
replace u = diff+1.96*(sediff)
replace n = . if n > 11

twoway (dot  diff n if treatment == 1 & n < 9, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  diff n if treatment == 0 & n < 9, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(rspike u l n if n < 9, horizontal color(black)), yti("") graphregion(color(white)) ///
xline(0) xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///
ylabel(1.5 "Clinton Mexico loan" 4.5 "Hypothetical Mexico loan" 7.5 "Biden student loan debt", angle(0)) /// 
legend(order( 1 "Unilateral: Zone 1 Treatment" 2 "Unilatral: Zone 3 Treatment") size(small) keygap(0) cols(2)) scale(.75) yscale(range(.5 5.5)) xti(" " "Difference vs. Legislation Baseline")

* Figure 5: Rule of Law Moderation, Follow-up Experiments *
use  "youngstown_34combined.dta", clear

logit mexloan_support i.mexloan_treat_zone1##c.rule_of_law dem5 gop5 female age education white if mexloan_treat_zone1 == 1|mexloan_treat_zone3 == 1
margins, dydx(mexloan_treat_zone1) at(rule_of_law=(1 (.1) 4) dem5=0 gop5=0 female=1 age=44 white=1 education=3) 
marginsplot, recast(line) recastci(rarea)  ///
title("Hypothetical Mexico loan") xtitle("Rule of Law Index") graphregion(color(white))   plot1opts(lpattern("solid") lcolor(black)) ///
ci1opts(color(gs10) lcolor(black)  color(%50))    yti("Zone 1 vs. Zone 3" " ")  ///
yline(0, style(foreground) lpattern(--)) scale(.75) saving(leg_hyploan_rol.gph, replace) 

logit clintonloan_support i.clintonloan_treat_zone1##c.rule_of_law dem5 gop5 female age education white if clintonloan_treat_zone1 == 1|clintonloan_treat_zone3 == 1
margins, dydx(clintonloan_treat_zone1) at(rule_of_law=(1 (.1) 4) dem5=0 gop5=0 female=1 age=44 white=1 education=3) 
marginsplot, recast(line) recastci(rarea)  ///
title("Clinton Mexico loan") xtitle("Rule of Law Index") graphregion(color(white))   plot1opts(lpattern("solid") lcolor(black)) ///
ci1opts(color(gs10) lcolor(black)  color(%50))  yti("Zone 1 vs. Zone 3" " ") ///
yline(0, style(foreground) lpattern(--)) scale(.75) saving(leg_clintonloan_rol.gph, replace) 

logit studentloans_support i.studentloans_treat_zone1##c.rule_of_law dem5 gop5 female age education white if studentloans_treat_zone1 == 1|studentloans_treat_zone3 == 1
margins, dydx(studentloans_treat_zone1) at(rule_of_law=(1 (.1) 4) dem5=0 gop5=0 female=1 age=44 white=1 education=3) 
marginsplot, recast(line) recastci(rarea)  ///
title("Hypothetical student loans") xtitle("Rule of Law Index") graphregion(color(white))   plot1opts(lpattern("solid") lcolor(black)) ///
ci1opts(color(gs10) lcolor(black)  color(%50))   yti("Zone 1 vs. Zone 3" " ") ///
yline(0, style(foreground) lpattern(--)) scale(.75) saving(leg_studentloans_rol.gph, replace) 

logit biden_studentloans_support i.biden_studentloans_treat_zone1##c.rule_of_law dem5 gop5 female age education white if biden_studentloans_treat_zone1 == 1|biden_studentloans_treat_zone3 == 1
margins, dydx(biden_studentloans_treat_zone1) at(rule_of_law=(1 (.1) 4) dem5=0 gop5=0 female=1 age=44 white=1 education=3) 
marginsplot, recast(line) recastci(rarea)  ///
title("Biden student loans") xtitle("Rule of Law Index") graphregion(color(white))   plot1opts(lpattern("solid") lcolor(black)) ///
ci1opts(color(gs10) lcolor(black)  color(%50))    yti("Zone 1 vs. Zone 3" " ")  ///
yline(0, style(foreground) lpattern(--)) scale(.75) saving(leg_bidenloans_rol.gph, replace) 

graph combine  "leg_bidenloans_rol.gph" "leg_hyploan_rol.gph" "leg_clintonloan_rol.gph" , graphregion(color(white)) rows(3) xsize(8.5) ysize(11)

* Figure 6: Effects by Party, Follow-up Experiments *
use  "youngstown_34combined.dta", clear
* Hypothetical Mexico Loan *
gen party3 = .
replace party3=1 if dem5==1
replace party3 = 2 if dem5 == 0 & gop5 == 0
replace party3 = 3 if gop5 == 1

gen mexloan_condition = .
replace mexloan_condition = 1 if mexloan_treat_legislation == 1
replace mexloan_condition = 2 if mexloan_treat_zone1 == 1
replace mexloan_condition = 3 if mexloan_treat_zone3 == 1

logit mexloan_support i.mexloan_condition##i.party3 female age education white rule_of_law
margins, at(party3=(1 (1) 3) mexloan_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)  post
margins, coeflegend
* Test Democrats delegation vs. contra Congress *
test _b[4._at] = _b[7._at]
* Test Independents delegation vs. contra Congress *
test _b[5._at] = _b[8._at]
* Test Republicans delegation vs. contra Congress *
test _b[6._at] = _b[9._at]

logit mexloan_support i.mexloan_condition##i.party3 female age education white rule_of_law
margins, at(party3=(1 (1) 3) mexloan_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)
matrix results = r(table)
matrix list results

gen n = _n
gen point = .
gen l = .
gen u = .
gen party = .
gen treatment = .

local a = results[1,1]
replace point = results[1,4] if n == 8
replace l = results[5,4] if n == 8
replace u = results[6,4] if n == 8
replace treatment = 1 if n == 8

replace point = results[1,7] if n == 7
replace l = results[5,7] if n == 7
replace u = results[6,7] if n == 7
replace treatment = 2 if n == 7

local b = results[1,2]
replace point = results[1,5] if n == 5
replace l = results[5,5] if n == 5
replace u = results[6,5] if n == 5
replace treatment = 1 if n == 5

replace point = results[1,8] if n == 4
replace l = results[5,8] if n == 4
replace u = results[6,8] if n == 4
replace treatment = 2 if n == 4

local c = results[1,3]
replace point = results[1,6] if n == 2
replace l = results[5,6] if n == 2
replace u = results[6,6] if n == 2
replace treatment = 1 if n == 2

replace point = results[1,9] if n == 1
replace l = results[5,9] if n == 1
replace u = results[6,9] if n == 1
replace treatment = 2 if n == 1

drop if n > 8

twoway (dot  point n if treatment == 1, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  point n if treatment == 2, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(dot  point n if treatment == 3, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(rspike u l n, horizontal color(black)), yti("") graphregion(color(white)) ///
xline(`a', lcolor(blue)) xline(`b', lpattern(dash) lcolor(black)) xline(`c', lpattern(shortdash)) xlabel(.1 .2 .3 .4 .5 .6 .7 .8 .9)  ///
ylabel(7.5 "Democrats" 4.5 "Independents" 1.5 "Republicans", angle(0)) /// 
legend(order( 1 "Unilateral: Delegated authority" 2 "Unilateral: Contra Congress")  size(vsmall) keygap(0) cols(2)) scale(.75) yscale(range(.5 8.5)) ti("Hypothetical Mexico loan") saving(hyploan_party.gph, replace)

* Clinton Mexico Loan *
use  "youngstown_34combined.dta", clear
gen party3 = .
replace party3=1 if dem5==1
replace party3 = 2 if dem5 == 0 & gop5 == 0
replace party3 = 3 if gop5 == 1

gen clintonloan_condition = .
replace clintonloan_condition = 1 if clintonloan_treat_legislation == 1
replace clintonloan_condition = 2 if clintonloan_treat_zone1 == 1
replace clintonloan_condition = 3 if clintonloan_treat_zone3 == 1

logit clintonloan_support i.clintonloan_condition##i.party3 female age education white rule_of_law
margins, at(party3=(1 (1) 3) clintonloan_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3) post
margins, coeflegend
* Test Democrats delegation vs. contra Congress *
test _b[4._at] = _b[7._at]
* Test Independents delegation vs. contra Congress *
test _b[5._at] = _b[8._at]
* Test Republicans delegation vs. contra Congress *
test _b[6._at] = _b[9._at] 

logit clintonloan_support i.clintonloan_condition##i.party3 female age education white rule_of_law
margins, at(party3=(1 (1) 3) clintonloan_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)
matrix results = r(table)
matrix list results

gen n = _n
gen point = .
gen l = .
gen u = .
gen party = .
gen treatment = .

local a = results[1,1]
replace point = results[1,4] if n == 8
replace l = results[5,4] if n == 8
replace u = results[6,4] if n == 8
replace treatment = 1 if n == 8

replace point = results[1,7] if n == 7
replace l = results[5,7] if n == 7
replace u = results[6,7] if n == 7
replace treatment = 2 if n == 7

local b = results[1,2]
replace point = results[1,5] if n == 5
replace l = results[5,5] if n == 5
replace u = results[6,5] if n == 5
replace treatment = 1 if n == 5

replace point = results[1,8] if n == 4
replace l = results[5,8] if n == 4
replace u = results[6,8] if n == 4
replace treatment = 2 if n == 4

local c = results[1,3]
replace point = results[1,6] if n == 2
replace l = results[5,6] if n == 2
replace u = results[6,6] if n == 2
replace treatment = 1 if n == 2

replace point = results[1,9] if n == 1
replace l = results[5,9] if n == 1
replace u = results[6,9] if n == 1
replace treatment = 2 if n == 1

drop if n > 8

twoway (dot  point n if treatment == 1, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  point n if treatment == 2, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(dot  point n if treatment == 3, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(rspike u l n, horizontal color(black)), yti("") graphregion(color(white)) ///
xline(`a', lcolor(blue)) xline(`b', lpattern(dash) lcolor(black)) xline(`c', lpattern(shortdash)) xlabel(.1 .2 .3 .4 .5 .6 .7 .8 .9) ///
ylabel(7.5 "Democrats" 4.5 "Independents" 1.5 "Republicans", angle(0)) /// 
legend(order( 1 "Unilateral: Delegated authority" 2 "Unilateral: Contra Congress")  size(vsmall) keygap(0) cols(2)) scale(.75) yscale(range(.5 8.5)) ti("Clinton Mexico loan") saving(clintonloan_party.gph, replace)

* Biden Student Loans *
use  "youngstown_34combined.dta", clear
gen party3 = .
replace party3=1 if dem5==1
replace party3 = 2 if dem5 == 0 & gop5 == 0
replace party3 = 3 if gop5 == 1

gen biden_studentloans_condition = .
replace biden_studentloans_condition = 1 if biden_studentloans_treat_leg == 1
replace biden_studentloans_condition = 2 if biden_studentloans_treat_zone1 == 1
replace biden_studentloans_condition = 3 if biden_studentloans_treat_zone3 == 1

logit biden_studentloans_support i.biden_studentloans_condition##i.party3 female age education white rule_of_law
margins, at(party3=(1 (1) 3) biden_studentloans_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)  post
margins, coeflegend
* Test Democrats delegation vs. contra Congress *
test _b[4._at] = _b[7._at]
* Test Independents delegation vs. contra Congress *
test _b[5._at] = _b[8._at]
* Test Republicans delegation vs. contra Congress *
test _b[6._at] = _b[9._at]

logit biden_studentloans_support i.biden_studentloans_condition##i.party3 female age education white rule_of_law
margins, at(party3=(1 (1) 3) biden_studentloans_condition=(1(1)3) rule_of_law = 2.8 female=1 age=44 white=1 education=3)
matrix results = r(table)
matrix list results

gen n = _n
gen point = .
gen l = .
gen u = .
gen party = .
gen treatment = .

local a = results[1,1]
replace point = results[1,4] if n == 8
replace l = results[5,4] if n == 8
replace u = results[6,4] if n == 8
replace treatment = 1 if n == 8

replace point = results[1,7] if n == 7
replace l = results[5,7] if n == 7
replace u = results[6,7] if n == 7
replace treatment = 2 if n == 7

local b = results[1,2]
replace point = results[1,5] if n == 5
replace l = results[5,5] if n == 5
replace u = results[6,5] if n == 5
replace treatment = 1 if n == 5

replace point = results[1,8] if n == 4
replace l = results[5,8] if n == 4
replace u = results[6,8] if n == 4
replace treatment = 2 if n == 4

local c = results[1,3]
replace point = results[1,6] if n == 2
replace l = results[5,6] if n == 2
replace u = results[6,6] if n == 2
replace treatment = 1 if n == 2

replace point = results[1,9] if n == 1
replace l = results[5,9] if n == 1
replace u = results[6,9] if n == 1
replace treatment = 2 if n == 1

drop if n > 8

twoway (dot  point n if treatment == 1, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  point n if treatment == 2, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(dot  point n if treatment == 3, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(rspike u l n, horizontal color(black)), yti("") graphregion(color(white)) ///
xline(`a', lcolor(blue)) xline(`b', lpattern(dash) lcolor(black)) xline(`c', lpattern(shortdash)) xlabel(.1 .2 .3 .4 .5 .6 .7 .8 .9)  ///
ylabel(7.5 "Democrats" 4.5 "Independents" 1.5 "Republicans", angle(0)) /// 
legend(order( 1 "Unilateral: Delegated authority" 2 "Unilateral: Contra Congress")  size(vsmall) keygap(0) cols(2)) scale(.75) yscale(range(.5 8.5)) ti("Biden student loans") saving(biden_studentloans_party.gph, replace)

grc1leg2   "biden_studentloans_party.gph" "hyploan_party.gph" "clintonloan_party.gph", graphregion(color(white)) rows(3) xsize(8.5) ysize(11)


